<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="public::head('投票表决')">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8"></meta>

</head>
<body style="padding-top:50px;">
<input type="hidden" th:value="${session.Id}" id="id"/>
<input type="hidden" th:value="${session.Type}" id="Type"/>

<div th:replace="public/top_vote::top"></div>

<div id="Votelist">

    <div class="primary-title">
        <div style="margin-top:15px;text-align: center;font-size:24px">
            <label  style="margin-left: 20px; ">{{xiangmu.xiangmuname}}</label>
        </div>
        <div style="text-align: center;font-size:18px">
            <label  style="margin-left: 20px; ">总数： {{total}} 同意： <font color="green">{{tongyishu}}</font> 不同意： <font color="red">{{butongyishu}}</font></label>
            <input v-if="!issubmited" type="button" class="btn btn-sm btn-primary" style="width: 60px" value="提交" @click="tosubmit()">
            <input v-if="issubmited" type="button" class="btn btn-sm btn-success" disabled style="width: 60px" value="已提交" >
        </div>
        <div>
            <input v-if="!issubmited" type="button" class="btn btn-sm btn-danger" style="width:80px;margin-right: 10px;float: right" value="全不同意" @click="toVoteAll(0)">
            <input v-if="!issubmited" type="button" class="btn btn-sm btn-success" style="width:80px;margin-right: 10px;float: right" value="全同意" @click="toVoteAll(1)">
        </div>
    </div>

    <div class="primary-content">
        <div class='table-head'>
        <table class="table table-hover table-striped" style="overflow:hidden; margin-bottom:10px;table-layout:fixed;height:60px;">
            <thead>
            <tr style="font-weight: bold;">
            <td style="text-align:center;vertical-align:middle;width:80px;">序号</td>
            <td style="text-align:center;vertical-align:middle;width:200px;">使用科室</td>
            <td style="text-align:center;vertical-align:middle;width:200px;">设备名称</td>
            <td style="text-align:center;vertical-align:middle;width:160px;">规格型号</td>
            <td style="text-align:center;vertical-align:middle;width:160px;">设备价值（万元）</td>
            <td style="text-align:center;vertical-align:middle;width:80px;">数量</td>
            <td style="text-align:center;vertical-align:middle;">生产厂商</td>
            <td style="text-align:center;vertical-align:middle;width:160px;">采购时间</td>
            <td style="text-align:center;vertical-align:middle;width:160px;">表决建议</td>
            </tr>
            </thead>
         </table>
         </div>
        <div class='table-body'>
            <table style="table-layout: fixed;">
            <tbody>
            <tr v-for="(voteitem,index) in votelist" v-if="show">
                <td style="text-align:center;vertical-align:middle;width:80px;" v-text="index+1"></td>
                <td style="text-align:center;vertical-align:middle;width:200px;" v-text="voteitem.shiyongkeshi"></td>
                <td style="text-align:center;vertical-align:middle;width:200px;" v-text="voteitem.shebeimingcheng"></td>
                <td style="text-align:center;vertical-align:middle;width:160px;" v-text="voteitem.guigexinghao"></td>
                <td style="text-align:center;vertical-align:middle;width:160px;" v-text="voteitem.sbjz"></td>
                <td style="text-align:center;vertical-align:middle;width:80px;" v-text="voteitem.shuliang"></td>
                <td style="text-align:center;vertical-align:middle;" v-text="voteitem.shengchanchangshang"></td>
                <td style="text-align:center;vertical-align:middle;width:160px;" v-text="voteitem.cgsj"></td>
                <td style="text-align:center;vertical-align:middle;width:160px;" >
                    <div style="text-align: center" :id="'jieguo'+voteitem.id">
                        <span v-if="voteitem.result==null" style="color:blue">未表决</span>
                        <span v-if="voteitem.result==0" style="color:red">不同意</span>
                        <span v-if="voteitem.result==1" style="color:green">同意</span>
                    </div>

                    <div style="text-align:center;">
                        <input v-if="!issubmited" type="button" class="btn btn-sm btn-success" style="width:60px;margin-left: 10px;float: left" value="同意" @click="toVote(voteitem.id,1)">
                        <input v-if="!issubmited" type="button" class="btn btn-sm btn-danger" style="width:60px;margin-left: 10px;float: left" value="不同意" @click="toVote(voteitem.id,0)">
                    </div>
                </td>
            </tr>
            </tbody>
            </table>
        </div>

        <div v-if="!show" style="text-align:center;width:100%;">暂无数据</div>


    </div>

</div>

</body>
<style>
    table{
        border:1px solid #e6e6e6;
        /*line-height: 5vh;*/
        color:#666666;
        font-size: 16px;
    }
    table {
        border-collapse: collapse;
        width: 100%;
    }
    td {
        padding:5px;
        border:1px solid #e6e6e6;
        font-size: 14px;
    }
    .table-head{padding-right:20px;background-color: #CDCDCD;color:#000;margin-top:80px;height:60px;}
    .table-body{width:100%; height:500px;overflow-y:scroll;}
    .table-head table,.table-body table{width:100%;}
    /*.table-body table tr:nth-child(2n+1){background-color: #CDCDCD;}*/

    .table-body table tr:hover {
        background-color:#dff0d8;
        transition: .2s;
    }
    .table-body table tr:hover td{background-color:rgb(240, 249, 228);}
</style>
<script th:src="@{/js/vote/list_baofei_vote.js}"></script>

<script type="text/javascript">
    var ID = $("#id").val();
    $(function() {
        if(ID==""){
            alert("请先登录！");
            location.href='../main/login';
        }
    });
</script>
</html>